<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE xsl:stylesheet  [
	<!ENTITY nbsp   "&#160;">
	<!ENTITY copy   "&#169;">
	<!ENTITY reg    "&#174;">
	<!ENTITY trade  "&#8482;">
	<!ENTITY mdash  "&#8212;">
	<!ENTITY ldquo  "&#8220;">
	<!ENTITY rdquo  "&#8221;"> 
	<!ENTITY pound  "&#163;">
	<!ENTITY yen    "&#165;">
	<!ENTITY euro   "&#8364;">
]>
<xsl:stylesheet version="1.0" 
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	xmlns:dlf="http://diglib.org/ilsdi/1.1">
<xsl:include href="labels.xsl" />
<xsl:include href="citation/styles.xsl" />

<xsl:template name="main">

	<html lang="eng">
	<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
	<title>Bridge: <xsl:value-of select="xerxes_record/title" /></title>
	<link type="text/css" rel="stylesheet" href="css/bridge.css" />
	<xsl:call-template name="header" />
	</head>
	
	<body>
	
	<div id="doc3" class="yui-t6">
	
		<div id="hd">
			<img src="images/wordmark.png" alt="bridge"/>
		</div>
		<div id="bd">
			<div id="yui-main">
				<div class="yui-b">
					<div id="main">
					
						<xsl:choose>
							<xsl:when test="xerxes_record">
								<xsl:call-template name="biblio" />
							</xsl:when>
							<xsl:otherwise>
								<xsl:call-template name="missing" />
							</xsl:otherwise>
						</xsl:choose>
					
					</div>
				</div>
			</div>
			<div class="yui-b">
				<div id="sidebar">
					<xsl:call-template name="citation" />
				</div>
			</div>
	
		</div>
		<div id="ft"></div>
	
	</div>
	
	</body>
	</html>

</xsl:template>

<xsl:template name="header">

	<script type="text/javascript">
	
	var oclc = '<xsl:value-of select="xerxes_record/control_number"/>';
	
	</script>
		
	<script src="javascript/scriptaculous/prototype.js" type="text/javascript"></script>
	<script src="javascript/scriptaculous/scriptaculous.js" type="text/javascript"></script>
	<script src="javascript/bridge.js" type="text/javascript"></script>


</xsl:template>

<xsl:template name="missing">
	
	<h1 class="error">Sorry, we couldn't find that book</h1>
	
</xsl:template>

<xsl:template name="biblio">

	<xsl:for-each select="xerxes_record">
		
		<div id="bookjacket">
			<img src="http://coverart.oclc.org/ImageWebSvc/oclc/{control_number}_140.jpg" alt="" />
		</div>
		
		<div id="biblio">
			<h1><xsl:value-of select="title_normalized" /></h1>
			
			<dl>
				
				<!-- Authors -->
				
				<xsl:if test="authors/author[@type = 'personal']">
					<div>
						<dt>By:</dt>
						<dd>
							<xsl:for-each select="authors/author[@type = 'personal']">
								<xsl:value-of select="aufirst" /><xsl:text> </xsl:text>
								<xsl:value-of select="auinit" /><xsl:text> </xsl:text>
								<xsl:value-of select="aulast" /><xsl:text> </xsl:text>
								
								<xsl:if test="following-sibling::author[@type = 'personal']">
									<xsl:text> ; </xsl:text>
								</xsl:if>
							</xsl:for-each>
						</dd>
					</div>
				</xsl:if>			

				
				<!-- Abstract -->
				
				<xsl:if test="abstract">
					<div>
						<dt>Summary:</dt>
						<dd><xsl:value-of select="abstract" /></dd>
					</div>
				</xsl:if>				
				
				
			</dl>

		
			<div id="editions">
				<h2>Editions</h2>
				<p id="editions-loading"><a href="./?action=editions&amp;oclc={//request/oclc}">Check for editions of this <xsl:value-of select="format" /></a></p>
			</div>
			
			<div id="holdings">
				<h2>Holdings</h2>
				<p id='holdings-loading'><a href="./?action=holdings&amp;oclc={//request/oclc}">Check for availability</a></p>
			</div>
	
			<!-- Table of Contents -->
			
			<xsl:if test="toc">
				<h2>
					<xsl:choose>
						<xsl:when test="format = 'Book'">
							<xsl:copy-of select="$text_record_chapters" />:
						</xsl:when>
						<xsl:otherwise>
							<xsl:copy-of select="$text_record_contents" />:
						</xsl:otherwise>
					</xsl:choose>
				</h2>
				<div class="recordAbstract">
					<ul>
					<xsl:for-each select="toc/chapter">
						<li>
							<xsl:choose>
								<xsl:when test="statement">
									<xsl:value-of select="statement" />
								</xsl:when>
								<xsl:otherwise>
									<em><xsl:value-of select="title" /></em>
									<xsl:text> </xsl:text><xsl:copy-of select="$text_results_author" /><xsl:text> </xsl:text>
									<xsl:value-of select="author" />
								</xsl:otherwise>
							</xsl:choose>
						</li>
					</xsl:for-each>
					</ul>
				</div>
			</xsl:if>
			
			<!-- Subjects -->
			
			<xsl:if test="subjects">
				<h2><xsl:copy-of select="$text_record_subjects" />:</h2>
				<ul>
					<xsl:for-each select="subjects/subject">
						<li><xsl:value-of select="text()" /></li>
					</xsl:for-each>
				</ul>
			</xsl:if>
	
			<!-- Standard Numbers -->
			
			<xsl:if test="standard_numbers">
				<h2><xsl:copy-of select="$text_record_standard_nos" />:</h2>
				<ul>
				<xsl:for-each select="standard_numbers/issn">
					<li><strong>ISSN</strong>: <xsl:value-of select="text()" /></li>
				</xsl:for-each>
				<xsl:for-each select="standard_numbers/isbn">
					<li><strong>ISBN</strong>: <xsl:value-of select="text()" /></li>
				</xsl:for-each>
				<xsl:for-each select="standard_numbers/gpo">
					<li><strong>GPO Item Number</strong>: <xsl:value-of select="text()" /></li>
				</xsl:for-each>
				<xsl:for-each select="standard_numbers/govdoc">
					<li><strong>Gov Doc Number</strong>: <xsl:value-of select="text()" /></li>
				</xsl:for-each>
				
				<xsl:for-each select="standard_numbers/oclc">
					<li><strong>OCLC number</strong>: <xsl:value-of select="text()" /></li>
				</xsl:for-each>
				</ul>
			</xsl:if>
			
			<!-- Notes -->
			
			<xsl:if test="notes">
				<h2><xsl:copy-of select="$text_record_notes" />:</h2>
				<ul>
					<xsl:for-each select="notes/note">
						<li><xsl:value-of select="text()" /></li>
					</xsl:for-each>
				</ul>
			</xsl:if>
		</div>
		
	</xsl:for-each>

</xsl:template>

<xsl:template name="holdings">

	<xsl:variable name="oclc" select="/*/request/oclc" />

	<xsl:choose>
	
		<xsl:when test="//holdings/holding">
		
			<xsl:for-each select="//libraries/group">
		
				<h2><xsl:value-of select="@name" /></h2>
				
				<p class="holdingsNote"><xsl:copy-of select="note" /></p>
				
				<ul>
				<xsl:for-each select="library">
					<xsl:variable name="symbol" select="@oclc" />
					<xsl:if test="//holdings/holding/institutionIdentifier/value = $symbol">					
						<li>
							<xsl:choose>
								<xsl:when test="@z3950 != ''">
									<a id="activate_{$symbol}_{$oclc}" onclick="lookup(this); return false;" class="holdingsLink" href="./?action=lookup&amp;library={$symbol}&amp;oclc={$oclc}">
										<xsl:value-of select="@name" />
									</a>
								</xsl:when>
								<xsl:otherwise>
									<a class="holdingsExternal" href="{//holdings/holding[institutionIdentifier/value = $symbol]/electronicAddress/text}">
										<xsl:value-of select="@name" />
									</a>
								</xsl:otherwise>
							</xsl:choose>
							<div id="lookup_{$symbol}"></div>
						</li>
					</xsl:if>
				</xsl:for-each>
				</ul>
			</xsl:for-each>
		
		</xsl:when>
		<xsl:otherwise>
			<p class="error">No Los Angeles area libraries or Cal State campuses own this item.</p>			
		</xsl:otherwise>
	</xsl:choose>
	
	
</xsl:template>

<xsl:template name="editions">

	<xsl:if test="xerxes_record">
	
		<h2>Editions</h2>

		<table class="editionsTable">
			<th>
				<tr class="tableHead">
					<td>Year</td>
					<td>Edition</td>
					<td>Language</td>
					<td>Format</td>
					<td>Publisher</td>
					<td>Availability</td>
				</tr>
			</th>
			<xsl:for-each select="xerxes_record">
				<tr>
					<td><xsl:value-of select="year" /></td>
					<td><xsl:value-of select="edition" /></td>
					<td><xsl:value-of select="language" /></td>
					<td><xsl:value-of select="format" /></td>
					<td><xsl:value-of select="publisher" /></td>
					<td>
						<a href="{/*/link_resolver/address}?rfr_id=info:sid/{/*/link_resolver/sid}&amp;{open_url}">
							<img src="http://sfx.calstate.edu:9003/chancellor/sfx.gif" alt="check for availabilty"/>
						</a>
					</td>
				</tr>
			</xsl:for-each>
		</table>
		
	</xsl:if>

</xsl:template>

<xsl:template name="citation">

	<xsl:for-each select="xerxes_record">
	
		<h2>
			<xsl:copy-of select="$text_record_cite_this" /><xsl:text> </xsl:text>
			<xsl:call-template name="text_results_format">
				<xsl:with-param name="format" select="format" />
			</xsl:call-template>
			<xsl:text> :</xsl:text>
		</h2>
		
		<div class="citation" id="citation_apa">
		
			<h3>APA</h3>
			<p class="citationStyle">
				<xsl:call-template name="apa" />
			</p>
			
		</div>
		
		<div class="citation" id="citation_mla">
			
			<h3>MLA</h3>
			<p class="citationStyle">
				<xsl:call-template name="mla" />
			</p>
			
		</div>
		
		<div class="citation" id="citation_turabian">
			
			<h3>Turabian</h3>
			<p class="citationStyle">
				<xsl:call-template name="turabian" />
			</p>
	
		</div>
	
		<p id="citationNote">
			<xsl:copy-of select="$text_record_citation_note" />
		</p>
		
	</xsl:for-each>

</xsl:template>

<xsl:template name="lookup">
	
	<xsl:choose>
		<xsl:when test="//dlf:simpleavailability">
			<table class="lookupTable">
				<th>
					<tr class="tableHead">
						<td>Location</td>
						<td>Call number</td>
						<td>Availability</td>
					</tr>
				</th>
				<xsl:for-each select="//dlf:simpleavailability">
					<tr>
						<td><xsl:value-of select="dlf:location" /></td>
						<td><xsl:value-of select="dlf:call_number" /></td>
						<td><xsl:value-of select="dlf:availabilitymsg" /></td>
					</tr>
				</xsl:for-each>	
			</table>
		</xsl:when>
		<xsl:otherwise>
			<p class="error">Sorry, we couldn't find any records at this library</p>
		</xsl:otherwise>
	</xsl:choose>

</xsl:template>

</xsl:stylesheet>